<script>
	$(function() {
		$( ".sub-list" ).button();
		$( "#format" ).buttonset();
		$("#onchangeclass").change(function(){
			str = '';
			 $("#onchangeclass option:selected").each(function () {
	                window.location = '/admin/classsubject/index/classid/'+$(this).val();
	              });
			});
		
	});
	</script>


<div id="page-content">
    <div id="page-content-wrapper">

        <div class="inner-page-title">
            <h2>Class management</h2>
            <span>Add Class Information</span>
        </div>
        <div id="add-users-data">
            <div class="column-content-box">
                <div class="content-box content-box-header ui-corner-all">
                 <form class="forms" id="classessubjectsform" method="post" action="/admin/classsubject/save">
                        <div class="ui-state-default ui-corner-top ui-box-header">
                            <span class="ui-icon float-left ui-icon-notice"></span>
							Class Information
                        </div>
                        <div class="content-box-wrapper">
                        <?php if(!empty($this->messages)) {
								?>
								<div class="response-msg success ui-corner-all">
								
								<?php 
								foreach ($this->messages as $message)
								{
									?>
									<span><?php echo $message ?></span>
									<?php 
								}
								?>
									Subject details saved successfully
								</div>
								
								<?php 
							}?>
                        <ul>
										<li>
											<label class="desc" for="firstname">Select Class</label>
											<div>
											 <select  class="field select large" name="classid" id="onchangeclass"> 
                        <option value=""> Choose One</option>	
                        <?php 
                        foreach ($this->classlist as $class_list)
                        {
                        	?>
                        <option value="<?php echo $class_list['id']?>" <?php echo ( ($this->class_id == $class_list['id']) ? 'selected' : '' )?>> <?php echo $class_list['class_name']?> </option>	
                        	<?php 
                        }
                        ?>
                        </select>
                        <input type="hidden" name="class_id_h" value="<?php echo $this->class_id ?>" /> 
											</div>
									</li>
                        </ul>
                        <div style="padding: 20px 0;">
                        <?php
                        if($this->list)
                        foreach($this->list as $list)
                        {
                        	?>
                        	 <input type="checkbox" id="<?php echo $list['name'] ?>" <?php  echo ($list['selected'] == true) ? 'checked' : ''?> name="subselected[<?php echo $list['id'] ?>]" class="sub-list" value="<?php echo $list['name'] ?>"/><label for="<?php echo $list['name'] ?>"><?php echo $list['name'] ?></label>
                        	<?php 
                        }
                        ?>
                        </div>
                         <ul>
										<li>
										<input class="submit ui-state-default ui-corner-all float-right ui-button" type="submit" value="Submit"/>
										</li>
						 </ul>
                        
                        </div>
                   </form>
                </div>
            </div>
        </div>
        

    </div>
</div>